package com.summer.framework.admin.controller.rest;

import com.summer.framework.admin.mq.StreamClient;
import com.summer.framework.api.dto.Msg;
import com.summer.framework.api.feign.service.stream.StreamApiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @auther: 杨杰
 * @date: 2019/5/9 17:44
 * @description:
 */
@RestController
@RequestMapping("/msg")
@Slf4j
public class StreamController {

    @Autowired
    private StreamApiService streamApiService;

    @Resource
    private StreamClient streamClient;

    @GetMapping("/send")
    public boolean send(@RequestParam String message) {
        log.info("message:" + message);
        return streamApiService.send(new Msg(message));
    }
}

